﻿@using BonjourQuotation.UI.Models.SetupModel
@model SetupSpecialDatesGridViewModel

@using (@Html.BeginForm("SaveSpecialDatesDetailData", "Setup", FormMethod.Post, new { id = "LoadSpecialDatesDetailsForm" }))
{
    <div id="ErrorMessagesDivPopUp" style="margin:auto;width:1150px; height: 30px; ">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>

    <div style="width:1161px; min-height:300px; max-height:442px; margin:auto; padding-bottom:30px; ">
        <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 1140px;background-color:white;">
            <thead>
                <tr>
                    <th width="9%;" class="GridHeaders">Country</th>
                    <th width="9%;" class="GridHeaders">City</th>
                    <th width="8%;" class="GridHeaders">Start</th>
                    <th width="8%;" class="GridHeaders">End</th>
                    <th width="14%;" class="GridHeaders">Vendor</th>
                    <th width="14%;" class="GridHeaders">Notes</th>
                    <th width="5%;" class="GridHeaders">Hotel</th>
                    <th width="5%;" class="GridHeaders">Attr.</th>
                    <th width="5%;" class="GridHeaders">Rest.</th>
                    <th width="5%;" class="GridHeaders">Misc</th>
                    <th width="5%;" class="GridHeaders">Bus</th>
                    <th width="6%;" class="GridHeaders">Active</th>
                    <th width="7%;" class="GridHeaders">Delete</th>
                </tr>
            </thead>
        </table>
        <div style="height:350px; overflow-y:auto;">
            <table class="table table-bordered table-hover table-condensed" style="width: 1140px; table-layout: fixed; background-color: white;">
                <tbody>
                    @for (int ind = 0; ind < Model.Rows.Count; ind++)
                    {
                        @Html.HiddenFor(model => model.Rows[ind].SpecialDatesID)
                        Model.SelectedSpecialDatesCountryID = Model.Rows[ind].CountryID;
                        Model.SelectedSpecialDatesCityID = Model.Rows[ind].SelectedSpecialDatesCityID;
                        @Html.HiddenFor(model => model.Rows[ind].CityID);
                        if(Model.MenuSetupSpecialDatesEdit)
                        { 
                            <tr>
                                <td width="9%;" style="text-align:left">
                                    @Html.DropDownListFor(model => Model.SelectedSpecialDatesCountryID, new SelectList(Model.CountryID, "Value", "Text"), new { @class = "table_inputs_100 table_inputs_WithoutBox ChangedSpecialDatesElements SpecialDatesElementsDrop CountryDrop ForValidation Required", @style = "text-align: left" })
                                    @Html.DropDownListFor(model => Model.Rows[ind].CountryID, new SelectList(Model.CountryID, "Value", "Text"), new { @class = "RoomGridDropHide Required" })
                                </td>
                                @if (Model.Rows[ind].VendorID == null || Model.Rows[ind].VendorID == "" || Model.Rows[ind].VendorID == "0")
                                {
                                    <td width="9%;" style="text-align:left">
                                        @Html.DropDownListFor(model => Model.SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "Select", new { @class = "table_inputs_100 table_inputs_WithoutBox ChangedSpecialDatesElements SpecialDatesElementsDrop ForChangeCityFromCountry ForValidation IsRemoveCityRequired Required", @style = "text-align: left" })
                                        @Html.DropDownListFor(model => Model.Rows[ind].SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "Select", new { @class = "RoomGridDropHide ForChangeCityFromCountryImit" })
                                    </td>
                                }
                                else
                                {
                                    <td width="9%;" style="text-align:left">
                                        @Html.DropDownListFor(model => Model.SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "Select", new { @class = "table_inputs_100 table_inputs_WithoutBox ChangedSpecialDatesElements SpecialDatesElementsDrop ForChangeCityFromCountry ForValidation IsRemoveCityRequired", @style = "text-align: left" })
                                        @Html.DropDownListFor(model => Model.Rows[ind].SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "Select", new { @class = "RoomGridDropHide ForChangeCityFromCountryImit" })
                                    </td>
                                }
                                <td width="8%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].SpecialDatesStartDate, new { @class = "table_inputs_80 table_inputs_WithoutBox ChangedSpecialDatesElements SpecialDatesDeteilsDataCalendarGridFrom ForValidation Date Required", @style = "text-align: left; cursor:pointer;" })</td>
                                <td width="8%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].SpecialDatesEndDate, new { @class = "table_inputs_80 table_inputs_WithoutBox ChangedSpecialDatesElements SpecialDatesDeteilsDataCalendarGridTo ForValidation Date Required", @style = "text-align: left; cursor:pointer;" })</td>
                                <td width="14%;" style="text-align:left">
                                    @Html.TextBoxFor(model => model.Rows[ind].VendorName, new { @class = "table_inputs_155 table_inputs_WithoutBox ChangedSpecialDatesElements QuotaTxtComplete VendorFromGrid", @style = "text-align: left;" }) 
                                    @Html.HiddenFor(model => model.Rows[ind].VendorID, new { @class = "VendorID"})
                                </td>
                                <td width="14%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].SpecialDatesNotes, new { @class = "table_inputs_155 table_inputs_WithoutBox ChangedSpecialDatesElements Required", @style = "text-align: left;" })</td>
                                @if (Model.Rows[ind].VendorID == null || Model.Rows[ind].VendorID == "" || Model.Rows[ind].VendorID == "0")
                                {
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsHotel, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime" })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsAttraction, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime" })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsRestaurant, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime" })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsMisc, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime" })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsBus, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime" })</td>
                                }
                                else
                                {
                                    Model.Rows[ind].IsHotel = false;
                                    Model.Rows[ind].IsAttraction = false;
                                    Model.Rows[ind].IsRestaurant = false;
                                    Model.Rows[ind].IsMisc = false;
                                    Model.Rows[ind].IsBus = false;
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsHotel, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime", @Disabled = true })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsAttraction, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime", @Disabled = true })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsRestaurant, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime", @Disabled = true })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsMisc, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime", @Disabled = true })</td>
                                    <td width="5%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsBus, new { @class = "ChangedSpecialDatesElements MakeReadOnlyInsetVendorTime", @Disabled = true })</td>
                                }
                                <td width="6%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsActive, new { @class = "ChangedSpecialDatesElements" })</td>
                                <td width="7%;" style="text-align:center"><button class="btn14 btn-danger btn60 btnheight22" type="button" onclick="DeleteSpecialDate(@Model.Rows[ind].SpecialDatesID)">Delete</button></td>
                            </tr>
                        }
                        else
                        {
                            <tr>
                            <td width="9%;" style="overflow: hidden">
                                @Html.DropDownListFor(model => Model.SelectedSpecialDatesCountryID, new SelectList(Model.CountryID, "Value", "Text"), new { @class = "table_inputs_114 table_inputs_WithoutBox DisabledDropDown", @disabled = "disabled", @style = "font-weight:bold" })
                                @Html.DropDownListFor(model => Model.Rows[ind].CountryID, new SelectList(Model.CountryID, "Value", "Text"), new { @class = "RoomGridDropHide Required" })
                            </td>
                            <td width="9%;" style="overflow: hidden">
                                @Html.DropDownListFor(model => Model.SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "", new { @class = "table_inputs_114 table_inputs_WithoutBox DisabledDropDown", @disabled = "disabled", @style = "font-weight:bold" })
                                @Html.DropDownListFor(model => Model.Rows[ind].SelectedSpecialDatesCityID, new SelectList(Model.Rows[ind].CityID, "Value", "Text"), "Select", new { @class = "RoomGridDropHide ForChangeSeriveTypesFromDetailTypesImit" })
                            </td>
                            <td width="8%;">@Html.LabelForModel(Model.Rows[ind].SpecialDatesStartDate, new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="8%;">@Html.LabelForModel(Model.Rows[ind].SpecialDatesEndDate, new { @class = "table_inputs_80", @style = "text-align: left" })</td>
                            <td width="14%;">@Html.LabelForModel(Model.Rows[ind].VendorName, new { @class = "table_inputs_155", @style = "text-align: left" })</td>
                            <td width="14%;">@Html.LabelForModel(Model.Rows[ind].SpecialDatesNotes, new { @class = "table_inputs_155", @style = "text-align: left" })</td>
                            <td width="5%;">@Html.LabelForModel(Model.Rows[ind].IsHotel ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="5%;">@Html.LabelForModel(Model.Rows[ind].IsAttraction ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="5%;">@Html.LabelForModel(Model.Rows[ind].IsRestaurant ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="5%;">@Html.LabelForModel(Model.Rows[ind].IsMisc ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="5%;">@Html.LabelForModel(Model.Rows[ind].IsBus ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="6%;">@Html.LabelForModel(Model.Rows[ind].IsActive ? "Yes" : "No", new { @class = "table_inputs_50", @style = "text-align: left" })</td>
                            <td width="7%;" style="text-align:center"><button class="btn14 btn-danger btn60 btnheight22" type="button" disabled="disabled" onclick="DeleteSpecialDate(@Model.Rows[ind].SpecialDatesID)">Delete</button></td>
                        </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
}
<div style="float: right; height: 25px; width: 140px; margin-right: 45px; ">
    <button class="btn14 btn60" style="float: left;@(@Model.IsCanView ? "" : "Display:none ")" type="button" id="SpecialDatesMoreBtn">More</button>
    @if (Model.MenuSetupSpecialDatesEdit)
    {
        <button class="btn14 btn50" style="float: right;" type="button" id="SpecialDatesDetailsSaveBtn">Save</button>
    }
    else
    {
        <button class="btn14 btn50" style="float: right;" type="button" disabled="disabled" id="SpecialDatesDetailsSaveBtn">Save</button>
    }
</div>
